<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('rd_alarm_msg', function (Blueprint $table) {
            $table->comment('报警事件回调');
            $table->bigIncrements('id');
            $table->unsignedTinyInteger('type')->comment('报警类型1:雷达 2:相机');
//            相机报警数据
            $table->string('alarm_pic_path', 255)->nullable()->comment('报警图片地址');
            $table->string('alarm_pic_name', 255)->nullable()->comment('报警图片名称');
            $table->unsignedBigInteger('camera_id')->nullable()->comment('摄像头ID');
            $table->string('camera_url', 255)->nullable()->comment('摄像头地址');
            $table->unsignedInteger('image_height')->nullable()->comment('图片高度');
            $table->unsignedInteger('image_width')->nullable()->comment('图片宽度');
            $table->json('result_data')->nullable()->comment('检测结果数据');
            $table->json('roi')->nullable()->comment('感兴趣区域');
            $table->string('src_pic_path', 255)->nullable()->comment('源图片地址');
            $table->string('src_pic_name', 255)->nullable()->comment('源图片名称');
            $table->unsignedBigInteger('task_id')->nullable()->comment('任务ID');
            $table->unsignedBigInteger('timestamp')->nullable()->comment('时间戳');
//            雷达报警数据
            $table->string('yj_data_id')->nullable()->comment('预警ID');
            $table->string('device_serial', 255)->nullable()->comment('设备序列号');
            $table->integer('channel_no')->nullable()->comment('通道号');
            $table->string('msg_type')->nullable()->comment('消息类型');
            $table->integer('alarm_type')->nullable()->comment('报警类型');
            $table->string('file_url', 255)->nullable()->comment('文件地址');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('rd_alarm_msg');
    }
};